home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / PInterfaces / Printing.p < prev    next >
Encoding:
Text File  |  1994-11-11  |  13.3 KB  |  485 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Printing.p
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. }
  16.  
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT Printing;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __PRINTING__}
  27. {$SETC __PRINTING__ := 1}
  28.  
  29. {$I+}
  30. {$SETC PrintingIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33.  
  34. {$IFC UNDEFINED __ERRORS__}
  35. {$I Errors.p}
  36. {$ENDC}
  37. {    ConditionalMacros.p                                            }
  38.  
  39. {$IFC UNDEFINED __QUICKDRAW__}
  40. {$I Quickdraw.p}
  41. {$ENDC}
  42. {    Types.p                                                        }
  43. {    MixedMode.p                                                    }
  44. {    QuickdrawText.p                                                }
  45.  
  46. {$IFC UNDEFINED __DIALOGS__}
  47. {$I Dialogs.p}
  48. {$ENDC}
  49. {    Memory.p                                                    }
  50. {    Windows.p                                                    }
  51. {        Events.p                                                }
  52. {            OSUtils.p                                            }
  53. {        Controls.p                                                }
  54. {            Menus.p                                                }
  55. {    TextEdit.p                                                    }
  56.  
  57. {$PUSH}
  58. {$ALIGN MAC68K}
  59. {$LibExport+}
  60.  
  61. CONST
  62.     iPFMaxPgs                    = 128;
  63.     iPrPgFract                    = 120;                            {Page scale factor. ptPgSize (below) is in units of 1/iPrPgFract}
  64.     iPrPgFst                    = 1;                            {Page range constants}
  65.     iPrPgMax                    = 9999;
  66.     iPrRelease                    = 3;                            {Current version number of the code.}
  67.     iPrSavPFil                    = -1;
  68.     iPrAbort                    = $0080;
  69.     iPrDevCtl                    = 7;                            {The PrDevCtl Proc's ctl number}
  70.     lPrReset                    = $00010000;                    {The PrDevCtl Proc's CParam for reset}
  71.     lPrLineFeed                    = $00030000;
  72.     lPrLFStd                    = $0003FFFF;                    {The PrDevCtl Proc's CParam for std paper advance}
  73.     lPrLFSixth                    = $0003FFFF;
  74.     lPrPageEnd                    = $00020000;                    {The PrDevCtl Proc's CParam for end page}
  75.     lPrDocOpen                    = $00010000;
  76.     lPrPageOpen                    = $00040000;
  77.     lPrPageClose                = $00020000;
  78.     lPrDocClose                    = $00050000;
  79.     iFMgrCtl                    = 8;                            {The FMgr's Tail-hook Proc's ctl number}
  80.     iMscCtl                        = 9;                            {The FMgr's Tail-hook Proc's ctl number}
  81.     iPvtCtl                        = 10;                            {The FMgr's Tail-hook Proc's ctl number}
  82.  
  83.     pPrGlobals                    = $00000944;                    {The PrVars lo mem area:}
  84.     bDraftLoop                    = 0;
  85.     bSpoolLoop                    = 1;
  86.     bUser1Loop                    = 2;
  87.     bUser2Loop                    = 3;
  88.     fNewRunBit                    = 2;
  89.     fHiResOK                    = 3;
  90.     fWeOpenedRF                    = 4;
  91. {Driver constants }
  92.     iPrBitsCtl                    = 4;
  93.     lScreenBits                    = 0;
  94.     lPaintBits                    = 1;
  95.     lHiScreenBits                = $00000002;                    {The Bitmap Print Proc's Screen Bitmap param}
  96.     lHiPaintBits                = $00000003;                    {The Bitmap Print Proc's Paint [sq pix] param}
  97.     iPrIOCtl                    = 5;
  98.     iPrEvtCtl                    = 6;                            {The PrEvent Proc's ctl number}
  99.     lPrEvtAll                    = $0002FFFD;                    {The PrEvent Proc's CParam for the entire screen}
  100.     lPrEvtTop                    = $0001FFFD;                    {The PrEvent Proc's CParam for the top folder}
  101.     iPrDrvrRef                    = -3;
  102.  
  103.     getRslDataOp                = 4;
  104.     setRslOp                    = 5;
  105.     draftBitsOp                    = 6;
  106.     noDraftBitsOp                = 7;
  107.     getRotnOp                    = 8;
  108.     NoSuchRsl                    = 1;
  109.     OpNotImpl                    = 2;                            {the driver doesn't support this opcode}
  110.     RgType1                        = 1;
  111.  
  112.     feedCut                        = 0;
  113.     feedFanfold                    = 1;
  114.     feedMechCut                    = 2;
  115.     feedOther                    = 3;
  116.  
  117.     
  118. TYPE
  119.     TFeed = SInt8;
  120.  
  121.  
  122. CONST
  123.     scanTB                        = 0;
  124.     scanBT                        = 1;
  125.     scanLR                        = 2;
  126.     scanRL                        = 3;
  127.  
  128.     
  129. TYPE
  130.     TScan = SInt8;
  131.  
  132. { A Rect Ptr }
  133.     TPRect = ^Rect;
  134.  
  135.     PrIdleProcPtr = ProcPtr;  { PROCEDURE PrIdle; }
  136.     PrIdleUPP = UniversalProcPtr;
  137.  
  138. CONST
  139.     uppPrIdleProcInfo = $00000000; { PROCEDURE ; }
  140.  
  141. FUNCTION NewPrIdleProc(userRoutine: PrIdleProcPtr): PrIdleUPP;
  142.     {$IFC NOT GENERATINGCFM }
  143.     INLINE $2E9F;
  144.     {$ENDC}
  145.  
  146. PROCEDURE CallPrIdleProc(userRoutine: PrIdleUPP);
  147.     {$IFC NOT GENERATINGCFM}
  148.     INLINE $205F, $4E90;
  149.     {$ENDC}
  150. TYPE
  151.     PItemProcPtr = ProcPtr;  { PROCEDURE PItem(theDialog: DialogPtr; item: INTEGER); }
  152.     PItemUPP = UniversalProcPtr;
  153.  
  154. CONST
  155.     uppPItemProcInfo = $000002C0; { PROCEDURE (4 byte param, 2 byte param); }
  156.  
  157. FUNCTION NewPItemProc(userRoutine: PItemProcPtr): PItemUPP;
  158.     {$IFC NOT GENERATINGCFM }
  159.     INLINE $2E9F;
  160.     {$ENDC}
  161.  
  162. PROCEDURE CallPItemProc(theDialog: DialogPtr; item: INTEGER; userRoutine: PItemUPP);
  163.     {$IFC NOT GENERATINGCFM}
  164.     INLINE $205F, $4E90;
  165.     {$ENDC}
  166.  
  167. TYPE
  168.     TPrPort = RECORD
  169.         gPort:                    GrafPort;                                {The Printer's graf port.}
  170.         gProcs:                    QDProcs;                                {..and its procs}
  171.         lGParam1:                LONGINT;                                {16 bytes for private parameter storage.}
  172.         lGParam2:                LONGINT;
  173.         lGParam3:                LONGINT;
  174.         lGParam4:                LONGINT;
  175.         fOurPtr:                BOOLEAN;                                {Whether the PrPort allocation was done by us.}
  176.         fOurBits:                BOOLEAN;                                {Whether the BitMap allocation was done by us.}
  177.     END;
  178.     TPPrPort = ^TPrPort;
  179.  
  180. { Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  181.   This is the "PrPeek" record. }
  182.     TPrInfo = RECORD
  183.         iDev:                    INTEGER;                                {Font mgr/QuickDraw device code}
  184.         iVRes:                    INTEGER;                                {Resolution of device, in device coordinates}
  185.         iHRes:                    INTEGER;                                {..note: V before H => compatable with Point.}
  186.         rPage:                    Rect;                                    {The page (printable) rectangle in device coordinates.}
  187.     END;
  188.     TPPrInfo = ^TPrInfo;
  189.  
  190. { Print Info Record: The parameters needed for page composition. }
  191.     TPrStl = RECORD
  192.         wDev:                    INTEGER;
  193.         iPageV:                    INTEGER;
  194.         iPageH:                    INTEGER;
  195.         bPort:                    SInt8;
  196.         feed:                    TFeed;
  197.     END;
  198.     TPPrStl = ^TPrStl;
  199.  
  200.     TPrXInfo = RECORD
  201.         iRowBytes:                INTEGER;
  202.         iBandV:                    INTEGER;
  203.         iBandH:                    INTEGER;
  204.         iDevBytes:                INTEGER;
  205.         iBands:                    INTEGER;
  206.         bPatScale:                SInt8;
  207.         bUlThick:                SInt8;
  208.         bUlOffset:                SInt8;
  209.         bUlShadow:                SInt8;
  210.         scan:                    TScan;
  211.         bXInfoX:                SInt8;
  212.     END;
  213.     TPPrXInfo = ^TPrXInfo;
  214.  
  215.     TPrJob = RECORD
  216.         iFstPage:                INTEGER;                                {Page Range.}
  217.         iLstPage:                INTEGER;
  218.         iCopies:                INTEGER;                                {No. copies.}
  219.         bJDocLoop:                SInt8;                                    {The Doc style: Draft, Spool, .., and ..}
  220.         fFromUsr:                BOOLEAN;                                {Printing from an User's App (not PrApp) flag}
  221.         pIdleProc:                PrIdleUPP;                                {The Proc called while waiting on IO etc.}
  222.         pFileName:                StringPtr;                                {Spool File Name: NIL for default.}
  223.         iFileVol:                INTEGER;                                {Spool File vol, set to 0 initially}
  224.         bFileVers:                SInt8;                                    {Spool File version, set to 0 initially}
  225.         bJobX:                    SInt8;                                    {An eXtra byte.}
  226.     END;
  227.     TPPrJob = ^TPrJob;
  228.  
  229. { Print Job: Print "form" for a single print request. }
  230.     TPrFlag1 = PACKED RECORD
  231.         f15:                    BOOLEAN;
  232.         f14:                    BOOLEAN;
  233.         f13:                    BOOLEAN;
  234.         f12:                    BOOLEAN;
  235.         f11:                    BOOLEAN;
  236.         f10:                    BOOLEAN;
  237.         f9:                        BOOLEAN;
  238.         f8:                        BOOLEAN;
  239.         f7:                        BOOLEAN;
  240.         f6:                        BOOLEAN;
  241.         f5:                        BOOLEAN;
  242.         f4:                        BOOLEAN;
  243.         f3:                        BOOLEAN;
  244.         f2:                        BOOLEAN;
  245.         fLstPgFst:                BOOLEAN;
  246.         fUserScale:                BOOLEAN;
  247.     END;
  248.     TPrint = RECORD
  249.         iPrVersion:                INTEGER;                                {(2) Printing software version}
  250.         prInfo:                    TPrInfo;                                {(14) the PrInfo data associated with the current style.}
  251.         rPaper:                    Rect;                                    {(8) The paper rectangle [offset from rPage]}
  252.         prStl:                    TPrStl;                                    {(8)  This print request's style.}
  253.         prInfoPT:                TPrInfo;                                {(14)  Print Time Imaging metrics}
  254.         prXInfo:                TPrXInfo;                                {(16)  Print-time (expanded) Print info record.}
  255.         prJob:                    TPrJob;                                    {(20) The Print Job request (82)  Total of the above; 120-82 = 38 bytes needed to fill 120}
  256.         CASE INTEGER OF
  257.         0: (
  258.             printX:                        ARRAY [0..18] OF INTEGER;
  259.            );
  260.         1: (
  261.             prFlag1:                    TPrFlag1;
  262.             iZoomMin:                    INTEGER;
  263.             iZoomMax:                    INTEGER;
  264.             hDocName:                    StringHandle;
  265.            );
  266.     END;
  267.     TPPrint = ^TPrint;
  268.     THPrint = ^TPPrint;
  269.  
  270. { The universal 120 byte printing record }
  271.     TPrStatus = RECORD
  272.         iTotPages:                INTEGER;                                {Total pages in Print File.}
  273.         iCurPage:                INTEGER;                                {Current page number}
  274.         iTotCopies:                INTEGER;                                {Total copies requested}
  275.         iCurCopy:                INTEGER;                                {Current copy number}
  276.         iTotBands:                INTEGER;                                {Total bands per page.}
  277.         iCurBand:                INTEGER;                                {Current band number}
  278.         fPgDirty:                BOOLEAN;                                {True if current page has been written to.}
  279.         fImaging:                BOOLEAN;                                {Set while in band's DrawPic call.}
  280.         hPrint:                    THPrint;                                {Handle to the active Printer record}
  281.         pPrPort:                TPPrPort;                                {Ptr to the active PrPort}
  282.         hPic:                    PicHandle;                                {Handle to the active Picture}
  283.     END;
  284.     TPPrStatus = ^TPrStatus;
  285.  
  286. { Print Status: Print information during printing. }
  287.     TPfPgDir = RECORD
  288.         iPages:                    INTEGER;
  289.         iPgPos:                    ARRAY [0..128] OF LONGINT;                {ARRAY [0..iPfMaxPgs] OF LONGINT}
  290.     END;
  291.     TPPfPgDir = ^TPfPgDir;
  292.     THPfPgDir = ^TPPfPgDir;
  293.  
  294. { PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) }
  295.     TPrDlg = RECORD
  296.         Dlg:                    DialogRecord;                            {The Dialog window}
  297.         pFltrProc:                ModalFilterUPP;                            {The Filter Proc.}
  298.         pItemProc:                PItemUPP;                                {The Item evaluating proc.}
  299.         hPrintUsr:                THPrint;                                {The user's print record.}
  300.         fDoIt:                    BOOLEAN;
  301.         fDone:                    BOOLEAN;
  302.         lUser1:                    LONGINT;                                {Four longs for user's to hang global data.}
  303.         lUser2:                    LONGINT;                                {...Plus more stuff needed by the particular printing dialog.}
  304.         lUser3:                    LONGINT;
  305.         lUser4:                    LONGINT;
  306.     END;
  307.     TPPrDlg = ^TPrDlg;
  308.  
  309.     PDlgInitProcPtr = ProcPtr;  { FUNCTION PDlgInit(hPrint: THPrint): TPPrDlg; }
  310.     PDlgInitUPP = UniversalProcPtr;
  311.  
  312. CONST
  313.     uppPDlgInitProcInfo = $000000F0; { FUNCTION (4 byte param): 4 byte result; }
  314.  
  315. FUNCTION NewPDlgInitProc(userRoutine: PDlgInitProcPtr): PDlgInitUPP;
  316.     {$IFC NOT GENERATINGCFM }
  317.     INLINE $2E9F;
  318.     {$ENDC}
  319.  
  320. FUNCTION CallPDlgInitProc(hPrint: THPrint; userRoutine: PDlgInitUPP): TPPrDlg;
  321.     {$IFC NOT GENERATINGCFM}
  322.     INLINE $205F, $4E90;
  323.     {$ENDC}
  324. { This is the Printing Dialog Record. Only used by folks appending their own dialogs.
  325. Print Dialog: The Dialog Stream object. }
  326.  
  327. TYPE
  328.     TGnlData = RECORD
  329.         iOpCode:                INTEGER;
  330.         iError:                    INTEGER;
  331.         lReserved:                LONGINT;                                {more fields here depending on call}
  332.     END;
  333.     TRslRg = RECORD
  334.         iMin:                    INTEGER;
  335.         iMax:                    INTEGER;
  336.     END;
  337.     TRslRec = RECORD
  338.         iXRsl:                    INTEGER;
  339.         iYRsl:                    INTEGER;
  340.     END;
  341.     TGetRslBlk = RECORD
  342.         iOpCode:                INTEGER;
  343.         iError:                    INTEGER;
  344.         lReserved:                LONGINT;
  345.         iRgType:                INTEGER;
  346.         xRslRg:                    TRslRg;
  347.         yRslRg:                    TRslRg;
  348.         iRslRecCnt:                INTEGER;
  349.         rgRslRec:                ARRAY [0..26] OF TRslRec;
  350.     END;
  351.     TSetRslBlk = RECORD
  352.         iOpCode:                INTEGER;
  353.         iError:                    INTEGER;
  354.         lReserved:                LONGINT;
  355.         hPrint:                    THPrint;
  356.         iXRsl:                    INTEGER;
  357.         iYRsl:                    INTEGER;
  358.     END;
  359.     TDftBitsBlk = RECORD
  360.         iOpCode:                INTEGER;
  361.         iError:                    INTEGER;
  362.         lReserved:                LONGINT;
  363.         hPrint:                    THPrint;
  364.     END;
  365.     TGetRotnBlk = RECORD
  366.         iOpCode:                INTEGER;
  367.         iError:                    INTEGER;
  368.         lReserved:                LONGINT;
  369.         hPrint:                    THPrint;
  370.         fLandscape:                BOOLEAN;
  371.         bXtra:                    SInt8;
  372.     END;
  373.  
  374. PROCEDURE PrPurge;
  375.     {$IFC NOT GENERATINGCFM}
  376.     INLINE $2F3C, $A800, $0000, $A8FD;
  377.     {$ENDC}
  378. PROCEDURE PrNoPurge;
  379.     {$IFC NOT GENERATINGCFM}
  380.     INLINE $2F3C, $B000, $0000, $A8FD;
  381.     {$ENDC}
  382. PROCEDURE PrOpen;
  383.     {$IFC NOT GENERATINGCFM}
  384.     INLINE $2F3C, $C800, $0000, $A8FD;
  385.     {$ENDC}
  386. PROCEDURE PrClose;
  387.     {$IFC NOT GENERATINGCFM}
  388.     INLINE $2F3C, $D000, $0000, $A8FD;
  389.     {$ENDC}
  390. PROCEDURE PrintDefault(hPrint: THPrint);
  391.     {$IFC NOT GENERATINGCFM}
  392.     INLINE $2F3C, $2004, $0480, $A8FD;
  393.     {$ENDC}
  394. FUNCTION PrValidate(hPrint: THPrint): BOOLEAN;
  395.     {$IFC NOT GENERATINGCFM}
  396.     INLINE $2F3C, $5204, $0498, $A8FD;
  397.     {$ENDC}
  398. FUNCTION PrStlDialog(hPrint: THPrint): BOOLEAN;
  399.     {$IFC NOT GENERATINGCFM}
  400.     INLINE $2F3C, $2A04, $0484, $A8FD;
  401.     {$ENDC}
  402. FUNCTION PrJobDialog(hPrint: THPrint): BOOLEAN;
  403.     {$IFC NOT GENERATINGCFM}
  404.     INLINE $2F3C, $3204, $0488, $A8FD;
  405.     {$ENDC}
  406. FUNCTION PrStlInit(hPrint: THPrint): TPPrDlg;
  407.     {$IFC NOT GENERATINGCFM}
  408.     INLINE $2F3C, $3C04, $040C, $A8FD;
  409.     {$ENDC}
  410. FUNCTION PrJobInit(hPrint: THPrint): TPPrDlg;
  411.     {$IFC NOT GENERATINGCFM}
  412.     INLINE $2F3C, $4404, $0410, $A8FD;
  413.     {$ENDC}
  414. PROCEDURE PrJobMerge(hPrintSrc: THPrint; hPrintDst: THPrint);
  415.     {$IFC NOT GENERATINGCFM}
  416.     INLINE $2F3C, $5804, $089C, $A8FD;
  417.     {$ENDC}
  418. FUNCTION PrDlgMain(hPrint: THPrint; pDlgInit: PDlgInitUPP): BOOLEAN;
  419.     {$IFC NOT GENERATINGCFM}
  420.     INLINE $2F3C, $4A04, $0894, $A8FD;
  421.     {$ENDC}
  422. FUNCTION PrOpenDoc(hPrint: THPrint; pPrPort: TPPrPort; pIOBuf: Ptr): TPPrPort;
  423.     {$IFC NOT GENERATINGCFM}
  424.     INLINE $2F3C, $0400, $0C00, $A8FD;
  425.     {$ENDC}
  426. PROCEDURE PrCloseDoc(pPrPort: TPPrPort);
  427.     {$IFC NOT GENERATINGCFM}
  428.     INLINE $2F3C, $0800, $0484, $A8FD;
  429.     {$ENDC}
  430. PROCEDURE PrOpenPage(pPrPort: TPPrPort; pPageFrame: TPRect);
  431.     {$IFC NOT GENERATINGCFM}
  432.     INLINE $2F3C, $1000, $0808, $A8FD;
  433.     {$ENDC}
  434. PROCEDURE PrClosePage(pPrPort: TPPrPort);
  435.     {$IFC NOT GENERATINGCFM}
  436.     INLINE $2F3C, $1800, $040C, $A8FD;
  437.     {$ENDC}
  438. PROCEDURE PrPicFile(hPrint: THPrint; pPrPort: TPPrPort; pIOBuf: Ptr; pDevBuf: Ptr; VAR prStatus: TPrStatus);
  439.     {$IFC NOT GENERATINGCFM}
  440.     INLINE $2F3C, $6005, $1480, $A8FD;
  441.     {$ENDC}
  442. FUNCTION PrError: INTEGER;
  443.     {$IFC NOT GENERATINGCFM}
  444.     INLINE $2F3C, $BA00, $0000, $A8FD;
  445.     {$ENDC}
  446. PROCEDURE PrSetError(iErr: INTEGER);
  447.     {$IFC NOT GENERATINGCFM}
  448.     INLINE $2F3C, $C000, $0200, $A8FD;
  449.     {$ENDC}
  450. PROCEDURE PrGeneral(pData: Ptr);
  451.     {$IFC NOT GENERATINGCFM}
  452.     INLINE $2F3C, $7007, $0480, $A8FD;
  453.     {$ENDC}
  454. PROCEDURE PrDrvrOpen;
  455.     {$IFC NOT GENERATINGCFM}
  456.     INLINE $2F3C, $8000, $0000, $A8FD;
  457.     {$ENDC}
  458. PROCEDURE PrDrvrClose;
  459.     {$IFC NOT GENERATINGCFM}
  460.     INLINE $2F3C, $8800, $0000, $A8FD;
  461.     {$ENDC}
  462. PROCEDURE PrCtlCall(iWhichCtl: INTEGER; lParam1: LONGINT; lParam2: LONGINT; lParam3: LONGINT);
  463.     {$IFC NOT GENERATINGCFM}
  464.     INLINE $2F3C, $A000, $0E00, $A8FD;
  465.     {$ENDC}
  466. FUNCTION PrDrvrDCE: Handle;
  467.     {$IFC NOT GENERATINGCFM}
  468.     INLINE $2F3C, $9400, $0000, $A8FD;
  469.     {$ENDC}
  470. FUNCTION PrDrvrVers: INTEGER;
  471.     {$IFC NOT GENERATINGCFM}
  472.     INLINE $2F3C, $9A00, $0000, $A8FD;
  473.     {$ENDC}
  474.  
  475. {$ALIGN RESET}
  476. {$POP}
  477.  
  478. {$SETC UsingIncludes := PrintingIncludes}
  479.  
  480. {$ENDC} {__PRINTING__}
  481.  
  482. {$IFC NOT UsingIncludes}
  483.  END.
  484. {$ENDC}
  485.